import 'package:flutter/material.dart';

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
          appBar: AppBar(
            title: Text('HadesCool'),
            //title底部的阴影大小
            elevation: 10.0,
            bottom: TabBar(
              //未选中的背景
              unselectedLabelColor: Colors.black38,
              //指示器颜色
              indicatorColor: Colors.black54,
              //指示器长度：根据内容长度一致
              indicatorSize: TabBarIndicatorSize.label,
              indicatorWeight: 1.0,
              tabs: <Widget>[
                Tab(icon: Icon(Icons.local_florist)),
                Tab(icon: Icon(Icons.change_history)),
                Tab(icon: Icon(Icons.directions_bike))
              ],
            ),
          ),
          body: TabBarView(
            children: <Widget>[
              Icon(
                Icons.local_florist,
                size: 128.0,
                color: Colors.black12,
              ),
              Icon(
                Icons.change_history,
                size: 128.0,
                color: Colors.black12,
              ),
              Icon(
                Icons.directions_bike,
                size: 128.0,
                color: Colors.black12,
              )
            ],
          ),
          drawer: Drawer(
            child: ListView(
              padding: EdgeInsets.zero,
              children: <Widget>[
                //TODO 抽屉的头部信息
                //用户账号头部控件
                UserAccountsDrawerHeader(
                  accountName: Text(
                    'HadesCool',
                    style: TextStyle(fontWeight: FontWeight.bold),
                  ),
                  accountEmail: Text('HadesCool@foxmail.com'),
                  currentAccountPicture: CircleAvatar(
                    backgroundImage: NetworkImage('http://img.funbling.net/Fr5pVA_Dn1pqrGFhMrQBQc9Z6aJz'),
                  ),
                ),
                ListTile(
                  title: Text('Message', textAlign: TextAlign.right),
                  trailing:
                      Icon(Icons.message, color: Colors.black12, size: 22.0),
                  onTap: () => Navigator.pop(context),
                ),
                ListTile(
                  title: Text('Favourite', textAlign: TextAlign.right),
//                  leading: 左边，trailing：右边
                  trailing:
                      Icon(Icons.favorite, color: Colors.black12, size: 22.0),
                  onTap: () => Navigator.pop(context),
                ),
                ListTile(
                  title: Text('Setting', textAlign: TextAlign.right),
                  trailing:
                      Icon(Icons.settings, color: Colors.black12, size: 22.0),
                  onTap: () => Navigator.pop(context),
                ),
              ],
            ),
          )),
    );
  }
}
